package xiaochangsama.ancientkungfugeneration.procedures;

import xiaochangsama.ancientkungfugeneration.network.AncientKungfuGenerationModVariables;
import xiaochangsama.ancientkungfugeneration.init.AncientKungfuGenerationModItems;

import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Entity;

public class EquipQingGongButtonProcedure {
	public static boolean execute(Entity entity) {
		if (entity == null)
			return false;
		if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == AncientKungfuGenerationModItems.JIANG_HU_QING_GONG_BOOK.get()
				&& (entity.getCapability(AncientKungfuGenerationModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new AncientKungfuGenerationModVariables.PlayerVariables())).PlayerQingGong != 1
				&& (entity.getCapability(AncientKungfuGenerationModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new AncientKungfuGenerationModVariables.PlayerVariables())).JiangHuQingGong) {
			return true;
		}
		return false;
	}
}
